package com.demo.controller;


import com.demo.entity.UserEntity;
import com.demo.service.UserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import java.util.List;

//@RequestMapping("/get")
@Controller
@ResponseBody
// @RestController 这个注解和上面两个注解效果是一样的
public class UserController {

    // 属性注入
    @Autowired
    private UserService userService;


    // 注意每个方法一般都有一个路径
    @RequestMapping("/getall")
    public List<UserEntity> getAll() {
        return userService.getAllUserEntity();
    }
}
